<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>题库管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/css/global.css" media="all">
    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="__PUBLIC__/BeginnerAdmin/css/table.css" />
</head>
<body>
<form>
    <div class="admin-main">

        <blockquote class="layui-elem-quote">
            <a href="javascript:;" class="layui-btn" id="add"onclick="NewLibraryUI();">
                <i class="layui-icon">&#xe608;</i> 添加教职工
            </a>
            <div class="layui-inline">
                <label class="layui-form-label"></label>
                <div class="layui-input-inline">
                    <input type="text" name="so" lay-verify="so" autocomplete="off" class="layui-input" placeholder="请输入要搜索的内容">
                </div>
                <a href="javascript:;" class="layui-btn" id="search">
                    <i class="layui-icon">&#xe615;</i> 搜索
                </a>
        </blockquote>
        <fieldset class="layui-elem-field">
            <legend>教职工列表</legend>
            <div class="layui-field-box layui-form">
                <table class="layui-table admin-table" width="400px">
                    <thead>
                    <tr>
                        <th style="width: 30px;">UID</th>
                        <th>姓名</th>
                        <th>手机</th>
                        <th>用户组</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody id="content">
                    <foreach name="list_user" item="v" key="k">
                        <tr>
                            <th><{$v.uid}></th>
                            <td><{$v.name}></td>
                            <td><{$v.mobile}></td>
                            <td>
                                <if condition="($v.group eq 1)">系统管理员<elseif condition="$v.group eq 2"/>教师<else />其他职工</if>
                            </td>
                            <td>
                                <div class="layui-btn-group">
                                    <a class="layui-btn" onclick="edit('<{$v.uid}>');">
                                        <i class="layui-icon">&#xe642;</i>
                                    </a>
                                    <a class="layui-btn" onclick="DeleteLibrary('<{$v.uid}>')">
                                        <i class="layui-icon">&#xe640;</i>
                                    </a>
                                </div>
                            </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
            </div>

            <div class="layui-inline" style="Float:right;display:inline;" align="right">
                <div class="layui-input-inline" style="width: 63px;">
                    <input type="number" id="page" name="page" style="height:30px;width: 60px;" autocomplete="off" class="layui-input" value="<{$page}>">
                </div>
                <a class="layui-btn layui-btn-small" href="javascript:;" onclick="page();">
                    <i class="layui-icon">&#xe609;</i>
                </a>
            </div>


            <div id="pagediv" style="Float:right;" class="layui-btn-group" align="right">
                <a class="layui-btn layui-btn-small layui-btn-primary">第<{$page}>页,总<{$count}>页</a>
                <a class="layui-btn layui-btn-small" href="<{:U('Teacher/Manage',array(page=>$page-1))}>">
                    <i class="layui-icon">&#xe603;</i>
                    <a class="layui-btn layui-btn-small" href="<{:U('Teacher/Manage',array(page=>$page+1))}>">
                        <i class="layui-icon">&#xe602;</i>
                    </a>
            </div>
        </fieldset>
        <div class="admin-table-page">
            <div id="paged" class="page">

            </div>
        </div>
    </div>
</form>
<script type="text/javascript" src="__PUBLIC__/BeginnerAdmin/plugins/layui/layui.js"></script>
<script type="text/javascript" src="__PUBLIC__/AmazeUI/assets/js/jquery-1.8.0.min.js"></script>

<script>
    layui.use('layer', function() {
        var $ = layui.jquery, layer = layui.layer;
    });
    function edit(uid) {
        layer.open({
            title: '修改信息',
            maxmin: false,
            type: 2,
            id:1,
            content: 'Admin_Teacher_EditTeacher.html?uid='+uid,
            area: ['400px', '500px'],
            end:function (index, layero) {
                settime();
            }
        });
    }
    function settime() {
        location.reload(true);
    }

    function NewLibraryUI() {
        layer.open({
            title: '添加教职工',
            maxmin: false,
            type: 2,
            id:1,
            content: 'Admin_Teacher_NewTeacherUI.html',
            area: ['400px', '500px'],
            end:function (index, layero) {
                settime();
            }
        });
    }


    function DeleteLibrary(id) {
        layer.open({
            title: '删除教职工',
            maxmin: false,
            type: 1,
            id:1,
            resize:false,
            content: '<div align="center">确定删除该教职人员？</div>',
            btn:['确定','取消'],
            btn1:function (index,layero) {
                $.post('Admin_Teacher_DeleteTeacher.html',
                    {'uid':uid},
                    function (date) {
                        if(date.code == 200){
                            layer.msg('删除成功！');
                            setTimeout('settime()', 1500);//延时执行，让人看得更清楚
                        }else{
                            layer.alert('删除失败！');
                        }
                    },'json');
                layer.close(index);
            },
            btn2:function (index,layero) {
            }
        });
    }




    function page() {
        window.location.href="Admin_Library_Manage.html?page="+$("#page").val();
    }



</script>
</body>
</html>